<?php
    class block_Ajax extends Ajax
    {
        public function loadSubCategories()
        {
            $oDatabase = new database();
            $sQuery = " PREFIX foaf: <http://xmlns.com/foaf/0.1/>
                        PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                        PREFIX dc: <http://purl.org/dc/elements/1.1/>
                        PREFIX bus: <".URL::getLink('id/bussiness#').">

                        SELECT * 
                        WHERE
                        {
                          ?uri bus:name ?name .
                          ?uri bus:subCategory ?category.
                          FILTER(?category= '".$_POST['category']."')
                        } ";
            $aResult = $oDatabase->loadQuery($sQuery);
            $aSubCategories = $aResult['result']['rows'];
            if(!count($aSubCategories))
            {
                return;
            }
            echo '<div class="sub_category_item">';
            echo '<ul>';
            foreach($aSubCategories as $aCategory)
            {
                echo '<li val="'.$aCategory['uri'].'">'.$aCategory['name'].'</li>';
            }
            echo '</ul>';
            echo '</div>';
        }
    }
?>
